Skip to content

p1 · unblocks cloud#4905 — feat(mcp): export the app-docs answer-order rule and its served-check from the barrel - #35759

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/area-a4C-35633
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/area-a4C-35633

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #35633
Clause-②: yes — widening: four new exported symbols on the published @objectstack/mcp barrel (packageDocAnswerRule, packageDocToolsServed, definitionReaderOf, DEFINITION_READER_TOOL_NAMES); nothing removed or refused. Seat runs a contract read before ready.
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;平台 MCP 的开场说明一字不变。
  • 为什么做:云端 MCP 入口自己写开场说明,要引用「先查应用手册、回答末尾给出处」这同一段话,现在能从平台包里直接取,不必抄第二份(云端对应卡「云端构建入口带上回答顺序」正等这一步)。
  • 出错会怎样:只多了几个对外可用的名字,原有行为不变;有问题可直接撤回。
  • 要你做的:无。

What changes

  • packages/mcp/src/mcp-server-runtime.ts: packageDocAnswerRule(definitionReader?) is now exported (its parameter became optional; same text). The reader pick moves into an exported pure helper definitionReaderOf(toolNames: Iterable<string>) over the now-exported DEFINITION_READER_TOOL_NAMES; the module-local definitionReaderServed calls it, so the open server's pick is unchanged.
  • packages/mcp/src/index.ts: the barrel re-exports packageDocAnswerRule, definitionReaderOf, DEFINITION_READER_TOOL_NAMES (from the runtime module) and packageDocToolsServed (from mcp-http-tools.ts, which this diff does not edit, so it stays apart from fix(mcp): slim the open door's tools/list; the served SKILL.md carries the teaching and names validate_expression's variables #35682's round on that file).
  • Signature designed for the host caller (cloud build door): every input is a plain argument. The host sends the rule where packageDocToolsServed(bridge, { grantedScopes }) is true and names definitionReaderOf(<tool names its connection lists>); no access to the open server's internals is needed.
  • New pin packages/mcp/src/package-doc-answer-rule-barrel-35633.test.ts imports from ./index.js: the four exports exist, and for each reader a connection lists (none, get_metadata_item, describe_metadata) the open server's default initialize text holds packageDocAnswerRule(reader) as one whole paragraph.
  • .changeset/35633-mcp-doc-answer-rule-export.md: '@objectstack/mcp': patch (Metadata-protocol none grades patch under ruling A in check-changeset-no-major.mjs).

No existing pin is flipped.

Verification

Two-minute check: pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/package-doc-answer-rule-barrel-35633.test.ts should print Tests 2 passed (2).

Read first (by risk): packages/mcp/src/mcp-server-runtime.ts (the definitionReaderServed hunk: same pick, now via definitionReaderOf), then packages/mcp/src/index.ts.

Local runs at a32f3e2 (code) and 01e6d0f (head; changeset line only)
  • pnpm --filter '@objectstack/mcp^...' build under the verify lock: VERDICT command-exit 0.
  • pnpm --filter @objectstack/mcp test: Test Files 80 passed (80), Tests 1441 passed (1441); typecheck (tsc + check:test-typecheck): OK; build: exit 0, dist/index.d.ts names the new exports.
  • node scripts/pm/dispatch-gates.mjs --commands derived list (64 commands) run locally: 67 derived, 65 exit 0, 2 NOT MEASURED (exit 3, prerequisite refused: check-plugin-teardown-shape --self-test needs an unshallowed clone; check:dual-build-cjs-loads needs every package built), 0 unrun; dispatch-gates --ran reconciliation 67 derived famil(ies) accounted for. Both NOT MEASURED families run in CI.
  • At 01e6d0f (the changeset's Clause-②: line copied verbatim from the claim) the changeset-reading families re-run, each exit 0: check-adr-0087-registration, check-changeset-no-major, check-empty-changeset, check:nul-bytes, check-issue-citations, check-closing-keyword-parity.
  • node scripts/pm/overlap-check.mjs --branch=claude/area-a4C-35633: VERDICT clean exit 0.
  • No ablation: the diff changes no tested behaviour (exports only; the open server's text and pick are byte-identical).

Acceptance notes

  • The card offered "rule text plus a way to name the reader" or "definitionReaderServed"; definitionReaderServed takes the open server's authoring injection, so the export is the pure name-list form definitionReaderOf instead, which definitionReaderServed now calls (one pick).
  • DEFINITION_READER_TOOL_NAMES lives in mcp-server-runtime.ts (in the claim's surface).

🤖 Generated with Claude Code

… from the barrel

A host that writes its own initialize text (instructions /
dataOnlyInstructions) can now carry the same answer-order sentence the open
server appends: packageDocAnswerRule, packageDocToolsServed,
definitionReaderOf and DEFINITION_READER_TOOL_NAMES are exported from
@objectstack/mcp. The open server keeps calling the same functions, so there
is one copy of the text; a barrel test pins it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4d1k1GRsQbF3vCPKxhz
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/mcp, touching 6 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/mcp/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/skills-reference.mdx (via get_metadata_item (literal, a string literal in DEFINITION_READER_TOOL_NAMES))
What this run could not see
  • 1 changed file(s) yielded no anchor (packages/mcp/src/index.ts) — pages documenting those are invisible to this run
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json cceb5c626d3c68a457e1dcf20de1fea0e0194366 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a24c845d07c900931e28eb7a30ed1a94514cbf2a — the merge of head beadd87426a43360203ba7910228d2c121ba55ef into base cceb5c626d3c68a457e1dcf20de1fea0e0194366, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a24c845d07c900931e28eb7a30ed1a94514cbf2a && git checkout a24c845d07c900931e28eb7a30ed1a94514cbf2a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cceb5c626d3c68a457e1dcf20de1fea0e0194366 beadd87426a43360203ba7910228d2c121ba55ef && git checkout -B drift-repro cceb5c626d3c68a457e1dcf20de1fea0e0194366 && git merge --no-ff beadd87426a43360203ba7910228d2c121ba55ef

node scripts/docs-audit/affected-docs.mjs --json cceb5c626d3c68a457e1dcf20de1fea0e0194366

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs cceb5c626d3c68a457e1dcf20de1fea0e0194366 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF
Served-tier: TIER_DEFAULT

Contract review — PASS at 01e6d0f

Head-sha: 01e6d0f64499d4c0e02ea45480eaf62a07092cae
Local-runs: probe — main's readClause2Line (scripts/pm/clause2-line.mjs) over this head's changeset text, to read the declaration's value and arm; nothing built or tested locally

Face: the Clause-②: yes declaration alone. record-recognisers.mjs --template --paths over the four changed paths reads the declaration face, TIER_DEFAULT. The diff has no packages/spec/src/** path, no governed path and no (narrowing) arm, so it does not escalate to CONTRACT_REVIEW_TIER. Read at 2026-11-20T06:09Z. The head has not moved since dispatch, and it merges cleanly onto origin/main cceb5c62.

① Derived judgments

Card #35633 "Done when", item by item:

  1. packageDocAnswerRule(definitionReader?) from the barrel: met. export function packageDocAnswerRule(definitionReader?: string): string in mcp-server-runtime.ts is re-exported in src/index.ts. The package exports map has only . (dist/index, built from src/index.ts), so this is the published surface.
  2. packageDocToolsServed(...) with the reader-name list the rule needs: met. It is re-exported from mcp-http-tools.ts, and that file is not in the diff. DEFINITION_READER_TOOL_NAMES and a pure definitionReaderOf(toolNames) are exported beside it. The card's alternative, definitionReaderServed, takes the open server's McpAuthoringInjection, so the name-list form is the better contract for a host.
  3. One copy of the text: met. openServerInstructions still calls packageDocAnswerRule(docRule.definitionReader), and definitionReaderServed now delegates to definitionReaderOf. The diff adds no second copy of the sentence.
  4. A test pins the barrel export: met. package-doc-answer-rule-barrel-35633.test.ts imports all four from ./index.js, the source of the sole exports['.'] entry. A self-import of @objectstack/mcp would need a built dist, so the source barrel is the right pin. For each case (no reader, get_metadata_item, describe_metadata), it asserts that the default initialize text holds packageDocAnswerRule(reader) as one whole paragraph.

Host composition (cloud build door). Every input is a plain value the host already holds when it calls handleHttpRequest: the bridge and grantedScopes for packageDocToolsServed, and the listed tool names for definitionReaderOf. The host's instructions (a grant that admits authoring) take packageDocAnswerRule(definitionReaderOf(listedToolNames)). Its dataOnlyInstructions take packageDocAnswerRule(). That matches the open server, which names a reader only under authoringToolsServed. The served-check is the same predicate registerPackageDocTools registers from (mcp-http-tools.ts:3345): the bridge carries both doc members, and the grant is data:read or undefined. It reads the right thing for any host whose doc tools come from the bridge, which is how the platform's runtime/src/domains/mcp-package-docs.ts serves them.

Byte-identical default text. This holds by construction. In packageDocAnswerRule only the signature line changed, from (definitionReader: string | undefined) to export … (definitionReader?: string), and every body line is diff context. definitionReaderServed keeps the authoringToolsServed gate and the same Set + find over the same tuple, in the same order. openServerInstructions and its call site are untouched. The #35442 pins (mcp-package-doc-tools-35442.test.ts) are not flipped.

Public surface. The index.ts diff adds exactly four value exports and no types. mcp-http-tools.ts is not in the diff. The three declarations newly marked export in mcp-server-runtime.ts can be reached only through the barrel, because exports has only .. The signatures:

  • packageDocAnswerRule(definitionReader?: string): string. An omitted or empty reader gives the "not checked" form.
  • definitionReaderOf(toolNames), which takes an Iterable of string and returns string | undefined. It picks in tuple order, not input order, and the test pins that.
  • packageDocToolsServed(bridge, options?), which takes a Partial McpDataBridge (or undefined) and RegisterObjectToolsOptions and returns boolean. Both parameter types were already exported from the barrel.

No internal type leaks.

② Semver level

'@objectstack/mcp': patch is right. Under AGENTS.md Post-Task Checklist step 3, the level follows the Metadata-protocol kind alone: none takes patch, and "a non-protocol change, widening or breaking, ships patch". The check-changeset-no-major.mjs self-test pins this exact pair: yes (widening) with none reads none-clean, which is patch. none is the correct kind, because nothing a metadata author can write changes. Check Changeset is green on this head.

Declaration lines: Clause-②: and Metadata-protocol: start a line in both the PR body and the changeset body. Main's reader reads value yes, arm null (a bare yes is a valid widening declaration), and kind none. yes is the right value, since the change widens a published package's export set and removes nothing. No Skills-docs: line is owed, because the kind is none and there is no (narrowing) arm.

③ Boundary flags

  • Dev report: open_questions and out_of_scope_findings are empty, and security reads none. Two deviations are noted: the claim line copied verbatim (that is S1 below) and the commit-trailer form.
  • SQL push-down: not applicable. There is no data path; the exports are pure string and predicate helpers.
  • Security: no runtime permission or grant behaviour changes. packageDocToolsServed is a read-only predicate that already gated registration.
  • Author: the PR user.login is objectstack-fleet[bot], so no separate author note is needed.
  • Docs-drift row (content/docs/ai/skills-reference.mdx via get_metadata_item): the literal is unchanged, so there is no drift.
  • CI when read: Check Changeset, PR-body guards, Governed Surface Queue Guard and Build Core are green. The Test Core shards, Type Check workspace/consumer and ESLint were still running. The landing check still needs them green.

Findings

S1 (should-fix): the declaration line miscounts the widening. The PR body and the changeset both say Clause-②: yes — widening: two new exported symbols on the published @objectstack/mcp barrel, but the barrel gains four: packageDocAnswerRule, packageDocToolsServed, definitionReaderOf and DEFINITION_READER_TOOL_NAMES. The line was copied verbatim from the claim, which was written before the design added the last two. The changeset line ships into packages/mcp/CHANGELOG.md, and fixing an error in a released entry takes a dedicated docs-only PR later. Fix: change "two" to "four" in the changeset and the PR-body line. The value yes and the level stay the same. This touches only the prose face, so this record carries over a changeset-only head move (Regen-provenance:).

N1 (nit): the README does not name the new exports. packages/mcp/README.md § "The initialize instructions" describes the answer-order rule and says a host's own text is "served exactly as written". One sentence there pointing a host at packageDocAnswerRule, packageDocToolsServed and definitionReaderOf would make the card's purpose discoverable. This is a prose-face change that can ride with S1's commit.

N2 (nit): host guidance for dataOnlyInstructions. The jsdoc says to pass "the reader its connection lists". It could also say that the data-only text takes packageDocAnswerRule(), since a grant without metadata:write lists no reader. Otherwise a host could feed its full registry's names into definitionReaderOf for that text. No code change is needed.

N3 (nit): DEFINITION_READER_TOOL_NAMES is now a published as const tuple. Its members and their order are part of the public type, so adding a reader later is a Clause-②: yes widening, not an internal edit. Accepted, because the card asked for the reader-name list.

No must-fix.

Implemented-by: claude/area-a4C-35633
Reviewed-by: session_016WV4d1PJ4isQ3eD7Fk1fnF

Independence: the diff was implemented on the branch above by dev session session_016WV4d1k1GRsQbF3vCPKxhz. This record was rendered by an isolated, read-only reviewer subagent that session_016WV4d1PJ4isQ3eD7Fk1fnF adopts. It was fed the diff, the card, the PR body and the dev report, and none of the drafter's conclusions were taken as findings.

VERDICT: PASS

Landing still needs S1 closed and CI green on the landing head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Final green head: beadd87426a43360203ba7910228d2c121ba55ef (Fixes #35633, p1; over 01e6d0f only the changeset Clause-② line now counts the four exports, the contract-review S1 in 7031974900). CI green (38 success, 18 skipped; one PR-body-guards run cancelled by a superseding run that passed). Contract review PASS 7031974900 carries (changeset-only push). Area a4-C asks L1-a for the L1 review on this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4czsTwiYB5WxgWqEVcu

L1 verdict (L1-a): ACCEPT at head beadd8742667 (announced in 7032412211, claim 7031289374, report 7031848641).

Gates on this head: 38 success, 18 expected skip, 0 unexpected skip, 0 pending. Lint & Repo Gates and TypeScript Type Check both passed. Mergeable: clean. l1-face.mjs --pr 35759 flags one cancelled run of "PR-body guards": that is check-run 136120245061 (started 06:10:49Z), superseded on the same head by 136120422624 (06:11:17Z) = success. Not a red.

What I checked (holds):

  • Fixes #35633 is right. The card's "done when" asks for packageDocAnswerRule(definitionReader?) and packageDocToolsServed(...) on the barrel, plus the reader-name list the rule needs, with one copy of the text and a barrel pin. The barrel now exports packageDocAnswerRule, definitionReaderOf, DEFINITION_READER_TOOL_NAMES (from mcp-server-runtime.ts) and packageDocToolsServed (already exported at mcp-http-tools.ts:3308, so that file is not in the diff). RegisterObjectToolsOptions and McpDataBridge, the types a host needs to call packageDocToolsServed, were already on the barrel. files: ["dist", …] ships them.
  • One copy, default text unchanged. packageDocAnswerRule's body is untouched; only the signature moves from a required string | undefined to an optional string and gains export. definitionReaderServed now calls definitionReaderOf(...), which is the same Set + find in the same DEFINITION_READER_TOOL_NAMES order it inlined before. The open server's call site (mcp-server-runtime.ts:1965) still calls the same function. No other package references either name.
  • The pin is a real pin. At the head: vitest run src/package-doc-answer-rule-barrel-35633.test.ts 2/2. Positive control: I swapped the DEFINITION_READER_TOOL_NAMES order on disk and the same run went 2 failed: both the reader-pick case and the "default initialize text holds packageDocAnswerRule(reader) whole" case. Restored, tree clean. The second case asserts the exact paragraph across no reader, get_metadata_item and describe_metadata, so a second copy of the text that drifted would fail it.
  • Contract read. The seat's contract review PASS (7031974900) is at 01e6d0f6. The one later commit, beadd874, changes only the changeset's Clause-② line: "two new exported symbols" becomes the four named exports. I checked that diff: 1 file, 1 line.
  • Changeset, sentence by sentence (.changeset/35633-mcp-doc-answer-rule-export.md): the four export signatures match the diff; "the same rule the open server appends to its default text" matches the initialize paragraphs the pin reads; "send it where packageDocToolsServed is true, naming the reader definitionReaderOf picks" matches the open server's own gate (docRule.served) and pick; "one copy of the sentence" and "Nothing else changes" match the diff. Patch for a widening of @objectstack/mcp is right.

Note (no action owed): definitionReaderOf(toolNames: Iterable<string>) would accept a bare string and iterate its characters. It returns undefined then, which is the safe answer ("not checked"), so this needs no change.

Landing: not governed (no skills/**, docs/adr/** or spec path). Clause-②: yes widening, already contract-read by the seat; the head moved since by a changeset-line commit only, so I am telling the seat in case it wants to re-stamp its PASS on beadd874 before the area lands it.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1PJ4isQ3eD7Fk1fnF

Served-tier: TIER_DEFAULT

Contract review — PASS at beadd87 (delta)

Seat delta read (2026-11-20T06:39Z): 01e6d0f6..beadd874 is one line in .changeset/35633-mcp-doc-answer-rule-export.md ("two new exported symbols" → the four named exports). It closes S1 of 7031974900 and changes no code. PASS 7031974900 carries to this head. No new findings.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-elon-musk · session_016WV4d1k1GRsQbF3vCPKxhz

Landing: ready + auto-merge at beadd87426a43360203ba7910228d2c121ba55ef · 2026-11-20T09:22Z

  • Authority: the maintainer in the a4-C area thread 2026-11-20T09:21Z: 「本区通过复审的 PR 都可以 ready + auto-merge」.
  • L1-a ACCEPT 7032461239 on this head; contract record 7031974900/7032485844; CI green; check-governed-merges --pr 35759: NOT governed.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 09:22
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 61831d2 Nov 20, 2026
57 of 58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-a4C-35633 branch November 20, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants